<template>
  <div class="app-container">
    <div class="searchBox">
      <el-form :inline="true" :model="search" ref="searchForm">
        <el-form-item label="新闻标题" prop="title">
          <el-input
            v-model="search.title"
            placeholder="请输入新闻标题"
            clearable
            size="small"
            @keyup.enter.native="searchQuery"
          />
        </el-form-item>
        <el-form-item label="发布时间" prop="pubdate">
          <el-date-picker
            clearable
            size="small"
            v-model="search.pubdate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择发布时间"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="作者" prop="author">
          <el-input
            v-model="search.author"
            placeholder="请输入作者"
            clearable
            size="small"
            @keyup.enter.native="searchQuery"
          />
        </el-form-item>
        <el-form-item label="来源" prop="origin">
          <el-input
            v-model="search.origin"
            placeholder="请输入来源"
            clearable
            size="small"
            @keyup.enter.native="searchQuery"
          />
        </el-form-item>
        <el-form-item style="margin-top: -2px">
          <el-button type="primary" @click="searchQuery">搜索</el-button>
          <el-button type="info" @click="search = {};searchQuery()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>

    <!-- useFormPage情况下，formPage不指定，默认取当前目录下的create -->
    <qm-table
      :data="query"
      keyProp="newsId"
      :formValidate="defaultFormValidate"
      :formOptions="{ labelWidth: '120px' }"
      menuType="text"
      isCustomForm
    >
      <qm-table-column field="title">新闻标题</qm-table-column>
      <qm-table-column field="pubdate" fieldtype="datetime" width="150">发布时间</qm-table-column>
      <qm-table-column field="author" width="100">作者</qm-table-column>
      <qm-table-column field="origin" width="100">来源</qm-table-column>
      <!-- 表格上面的工具栏，可自行添加和业务相关的按钮 -->
      <template v-slot:toolbar></template>

      <!-- 列表操作列，可自行添加和业务相关的按钮 -->
      <template v-slot:moreBtn="{ row }"></template>
      <template v-slot:form="{ models, model,disabled }">
        <create
          ref="create"
          :models="models"
          :model="model"
          :disabled="disabled"
        ></create>
      </template>
    </qm-table>
  </div>
</template>

<script>
import Controller from "@/libs/framework/controller";
import Create from "./create";
export default class Instance extends Controller {
  onBeforeInit() {
    this.urls = {
      model: "/eip/websiteNews/getListModel",
      query: "/eip/websiteNews/query",
      save: "/eip/websiteNews/save",
      delete: "/eip/websiteNews/delete",
      entity: "/eip/websiteNews/getEntity",
    };
  }

  mixin() {
    return {
      components: {
        Create,
      },
      data() {
        return {};
      },
      methods: {},
    };
  }
}
</script>

<style scoped lang="scss">
</style>